package com.yanqu.road.entity.activity.biaoju;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.date.DateHelper;
import org.apache.mina.util.ConcurrentHashSet;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

@FieldTypeAnnotation(tableName = "t_c_biaoju_user", desc = "镖局玩家数据")
public class CrossBiaoJuUserData extends DataObject {
    @FieldTypeAnnotation(select = true, update = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(update = true, isIndex = true)
    private long userId;
    @FieldTypeAnnotation(select = true, update = true, isIndex = true, desc = "商会分组")
    private int unionGroup;
    @FieldTypeAnnotation(desc = "商会id")
    private String unionId;
    @FieldTypeAnnotation(desc = "商会职位")
    private int unionPos;
    @FieldTypeAnnotation(desc = "镖师等级")
    private int level;
    @FieldTypeAnnotation(desc = "经验")
    private long exp;
    @FieldTypeAnnotation(desc = "经验变更时间")
    private long expChangeTime;
    @FieldTypeAnnotation(desc = "赏金")
    private long money;
    @FieldTypeAnnotation(desc = "保底前累计")
    private int guaranteeAmount;
    @FieldTypeAnnotation(desc = "最近一次刷新时间")
    private long lastRefreshTime;
    @FieldTypeAnnotation(desc = "身上随机到的镖")
    private List<BiaoJuUserEscortInfo> waitTakeList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "个人排名")
    private int rank;
    @FieldTypeAnnotation(desc = "最近一次确认完成押镖的时间")
    private long lastConfirmFinishTime;
    @FieldTypeAnnotation(desc = "每日加入队伍次数")
    private int dayJoinNum;
    @FieldTypeAnnotation(desc = "每日加入队伍获得奖励次数")
    private int dayJoinRewardNum;
    @FieldTypeAnnotation(desc = "可以被拉进队的镖队品质")
    private Set<Integer> canBePullQuality = new ConcurrentHashSet<>();
    @FieldTypeAnnotation(desc = "商会所有人都可以拉自己")
    private int settingSwitch;
    @FieldTypeAnnotation(desc = "指定可以拉自己的成员")
    private Set<Long> canPullId = new ConcurrentHashSet<>();
    @FieldTypeAnnotation(desc = "建设提供的镖局声望")
    private long unionExpAdd;
    @FieldTypeAnnotation(desc = "建设提供的镖局声望/每日")
    private long dayUnionExpAdd;
    @FieldTypeAnnotation(desc = "建设镖局时间")
    private long lastBuildTime;


    public CrossBiaoJuUserData(int activityId, long userId, int unionGroup, String unionId) {
        this.activityId = activityId;
        this.userId = userId;
        this.unionGroup = unionGroup;
        this.unionId = unionId;
        this.level = 1; //初始1级
        this.expChangeTime = DateHelper.getCurrentTime();
        setInsertOption();
    }

    public CrossBiaoJuUserData() {
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public int getUnionGroup() {
        return unionGroup;
    }

    public void setUnionGroup(int unionGroup) {
        this.unionGroup = unionGroup;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public int getUnionPos() {
        return unionPos;
    }

    public void setUnionPos(int unionPos) {
        this.unionPos = unionPos;
        setUpdateOption();
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        if (this.level != level) {
            this.level = level;
            setUpdateOption();
        }
    }

    public long getExp() {
        return exp;
    }

    public void setExp(long exp) {
        this.exp = exp;
        setUpdateOption();
    }

    public void addExp(long expAdd) {
        long result = this.exp + expAdd;
        this.exp = result;
        this.expChangeTime = DateHelper.getCurrentTime();
        setUpdateOption();
    }

    public int getGuaranteeAmount() {
        return guaranteeAmount;
    }

    public void setGuaranteeAmount(int guaranteeAmount) {
        this.guaranteeAmount = guaranteeAmount;
        setUpdateOption();
    }

    public long getLastRefreshTime() {
        return lastRefreshTime;
    }

    public void setLastRefreshTime(long lastRefreshTime) {
        this.lastRefreshTime = lastRefreshTime;
        setUpdateOption();
    }

    public List<BiaoJuUserEscortInfo> getWaitTakeList() {
        return waitTakeList;
    }

    public void setWaitTakeList(List<BiaoJuUserEscortInfo> waitTakeList) {
        this.waitTakeList = waitTakeList;
        setUpdateOption();
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        if (this.rank != rank) {
            this.rank = rank;
            setUpdateOption();
        }
    }

    public long getLastConfirmFinishTime() {
        return lastConfirmFinishTime;
    }

    public void setLastConfirmFinishTime(long lastConfirmFinishTime) {
        this.lastConfirmFinishTime = lastConfirmFinishTime;
        setUpdateOption();
    }

    public long getMoney() {
        return money;
    }

    public void setMoney(long money) {
        this.money = money;
        setUpdateOption();
    }

    public void addMoney(long addMoney) {
        long result = this.money + addMoney;
        this.money = result;
        setUpdateOption();
    }

    public int getDayJoinNum() {
        return dayJoinNum;
    }

    public void setDayJoinNum(int dayJoinNum) {
        this.dayJoinNum = dayJoinNum;
        setUpdateOption();
    }

    public int getDayJoinRewardNum() {
        return dayJoinRewardNum;
    }

    public void setDayJoinRewardNum(int dayJoinRewardNum) {
        this.dayJoinRewardNum = dayJoinRewardNum;
        setUpdateOption();
    }

    public long getExpChangeTime() {
        return expChangeTime;
    }

    public void setExpChangeTime(long expChangeTime) {
        this.expChangeTime = expChangeTime;
        setUpdateOption();
    }

    public Set<Integer> getCanBePullQuality() {
        return canBePullQuality;
    }

    public void setCanBePullQuality(Set<Integer> canBePullQuality) {
        this.canBePullQuality = canBePullQuality;
        setUpdateOption();
    }

    public int getSettingSwitch() {
        return settingSwitch;
    }

    public void setSettingSwitch(int settingSwitch) {
        this.settingSwitch = settingSwitch;
        setUpdateOption();
    }

    public long getUnionExpAdd() {
        return unionExpAdd;
    }

    public void setUnionExpAdd(long unionExpAdd) {
        this.unionExpAdd = unionExpAdd;
        setUpdateOption();
    }

    public long getLastBuildTime() {
        return lastBuildTime;
    }

    public void setLastBuildTime(long lastBuildTime) {
        this.lastBuildTime = lastBuildTime;
        setUpdateOption();
    }

    public long getDayUnionExpAdd() {
        return dayUnionExpAdd;
    }

    public void setDayUnionExpAdd(long dayUnionExpAdd) {
        this.dayUnionExpAdd = dayUnionExpAdd;
        setUpdateOption();
    }

    public Set<Long> getCanPullId() {
        return canPullId;
    }

    public void setCanPullId(Set<Long> canPullId) {
        this.canPullId = canPullId;
        setUpdateOption();
    }
}
